<?php

App::uses('AppController', 'Controller');

class LogsControllerTest extends ControllerTestCase {
	
	public $fixtures = array('app.log');
	
	public function testLogsAuthorizationWithoutAuth(){
		$expected = false;
		$actual = $this->testAction('/logs/isAuthorized', array('return' => 'result'));
		$this->assertEquals($expected, $actual);
	}

	public function testLogsAuthorizationWithAuth(){
		$this->Logs = $this->generate('Logs', array(
																	'components' => array(
																								'Auth' => array('user')
																								)
																  	)
												 );
		$this->controller->Auth->staticExpects($this->any())
			->method('user')
			->with('csoport')
			->will($this->returnValue(1));
		$expected = true;
		$actual = $this->testAction('/logs/isAuthorized', array('return' => 'result'));
		$this->assertEquals($expected, $actual);
	}

	public function testLogsIndex(){
		$expected = true;
		$actual = $this->testAction('/logs/index', array('return' => 'result'));
		$this->assertEquals($expected, $actual);
	}

	public function testLogsView(){
		$expected = true;
		$actual = $this->testAction('/logs/view/5', array('return' => 'result'));
		$this->assertEquals($expected, $actual);
		
		$expected = false;
		$actual = $this->testAction('/logs/view/', array('return' => 'result'));
		$this->assertEquals($expected, $actual);
		
	}
}
?>